c###gmloss.for
      SUBROUTINE GMLOSS
C--------------------------------
C
C     THIS SUBROUTINE CALCULATES THE GAIN MINUS LOSS FUNCTION
C
      COMMON /DON /ALATD, AMIN, AMIND, BTR, BTRD, DLONG, DMP, ERTR, GCD,
     1 GCDKM, PMP, PWR, TLAT, TLATD, TLONG, TLONGD, RSN, SIGTR, RLAT,
     2 RLATD,RLONG,RLONGD,BRTD,FLUX,ULAT,ULATD,ULONG,ULONGD,SSN,D90R,
     3 D50R,D10R,D90S,D50S,D10S
      COMMON/LPATH/ GCDLNG,TXRGML(45,2),DELOPT,GMIN,YMIN,LTXRGM(2)
      COMMON/LOSX/ANDVX(45,3),ADVX(45,3),AOFX(45,3),ARFX(45,3),GRLOSX(45
     A ,3),TGAINX(45,3),TLSKM(45,3),EFFlp(45),IAFTXR(3)
      COMMON/REFLX/DELFX(45,3),HPFLX(45,3),HTFLX(45,3),GDFLX(45,3),FVFLX
     A (45,3),DSKPKM(3),DELSKP(3),HPSKP(3),HTSKP(3),DMAXKM(3),FVSKP(3)
     B ,ISKP(3),IMODE(45,3),AFFLX(45,3),DELPEN(3,5),GML(45,3),FHP(45,3)
      COMMON / ZON / ABPS(7), CREL(7), EFF(7), FLDST(7), GRLOS(7),
     1 HN(7), HP(7), PROB(7), RELY(7), RGAIN(7), SIGPOW(7), SN(7),
     2 SPRO(7), TGAIN(7), TIMED(7), TLOSS(7), B(7), FSLOS(7), ADV(7),
     3 OBF(7),NMODE(7),TLLOW(7),TLHGH(7)
      COMMON/FRQ/FREA(13),FREL(29),FREQ,JMODE,ITXRCP(2)
C.....PRESET ALL ARRAYS
      DO 240 IM = 1,7
      OBF(IM)    = 1000.
      ADV(IM)    = 1000.
      FSLOS(IM)  = 1000.
      TLOSS(IM)  = 1000.
      ABPS(IM)   = 1000.
      EFF (IM)   = 0.0
      GRLOS(IM) = 1000.0
      RGAIN(IM)  = 0.0
      TGAIN(IM)  = 0.0
      HN(IM)     =-1.
      PROB(IM)   = 0.001
      CREL(IM)   = 0.001
      RELY(IM)   = 0.001
      SPRO(IM)   = 0.001
      FLDST(IM) = -1000.0
      SIGPOW(IM) =-1000.
      SN(IM)     =-1000.
      TIMED(IM)  =-1.
      HP(IM)     =-1.
      B(IM)      =-1.
      NMODE(IM) = 5
  240 CONTINUE
C.....TRANSMITTER/RECEIVER ENDS
      CALL SETTXR
      DO 120 JJ=1,2
      K=ITXRCP(JJ)
      DO 110 IA=1,IAFTXR(K)
C.....AT LEAST AN OVER THE MUF
      IF(HPFLX(IA,K)- 70.) 110,105,105
  105 IF( DELFX(IA,K) - AMIND) 110,106,106
C.....GAIN-LOSS, TRANSMITTER /RECEIVER ENDS
  106 TXRGML(IA,JJ) = TGAINX(IA,K) - (ANDVX(IA,K) + ADVX(IA,K) )
  110 CONTINUE
  120 CONTINUE
      RETURN
      END
C--------------------------------
